package com.xjzd.std.concurrency;

import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

public class ReentrantLockDemo {

    public static void main1(String[] args) {
        ReentrantLock lock = new ReentrantLock();
        // Condition condition = lock.newCondition();
        lock.lock();

        try {
            System.out.println("业务代码");
        } finally {
            lock.unlock();
        }
    }

    public static void main(String[] args) {
        ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
        rwLock.readLock().lock();
        rwLock.writeLock().lock();
    }
}
